//app.js
App({
  onLaunch: function () {
    
  },
  globalData: {
    userInfo: null,
    user: null,
    safeCode: 0,
    registerCode: 0,
    findPwdCode: 0
  },
  openID: null,
  shareQid: null,
  shareUid: null,
  sharePhoto: null,
  isExist: false,
  // API_host:"http://wxtest.trfriend.com/",
  API_host: 'https://wxapi.trfriend.com/',
  // API_host:'http://localhost:18515/',
  picture_host:'http://qiniu.trfriend.com/',
  map_key:"KAWBZ-OIS6S-CS6OB-6SVQL-LW6C6-ZZF7Q",
  showMsg: function showMsg(msg, messagetype, callback) {
    var messageSign = "none";
    if (messagetype == 1) {
      messageSign = "success";
    } else {

    }
    var duration = 2000;
    wx.showToast({
      title: msg,
      icon: messageSign,
      duration: duration,
      success: function () {
        if (callback) {
          setTimeout(function () {
            callback();
          }, duration)
        }
      }
    })
  },
  maskName: function maskName(name, isMy) {
    if (isMy){
      return name;
    }

    var mask = "";
    var nameLength = name.length;
    for (var j = 0; j < nameLength - 2; j++) {
      mask += "*";
    }
    if (nameLength == 2) {
      name = name[0] + "*"
    }
    else if (nameLength >= 3) {
      name = name[0] + mask + name[nameLength - 1];
    }
    return name;
  }
})